const GaoxinService = require('../services/gaoxinService')

class GaoxinController {
  // 获取原始告警列表
  async getOriginList(req, res) {
    try {
      const params = req.query
      // 实际环境中使用真实接口
      // const data = await GaoxinService.getOriginList(params)

      // 使用模拟数据
      const data = await GaoxinService.getOriginList(params)

      res.json({
        code: 200,
        data,
        msg: '获取成功',
      })
    } catch (error) {
      throw error
    }
  }
  // 获取告警集列表
  async getAlaramCollectionsList(req, res) {
    try {
      const params = req.query
      // 使用模拟数据
      const data = await GaoxinService.getAlaramCollectionsList(params)
      res.json({
        code: 200,
        data,
        msg: '获取成功',
      })
    } catch (error) {
      throw error
    }
  }
  // 获取告警集列表-详情-左侧
  async getAlarmCollectionsDetail(req, res) {
    try {
      const params = req.query
      // 使用模拟数据
      const data = await GaoxinService.getAlarmCollectionsDetail()
      res.json({
        code: 200,
        data,
        msg: '获取成功',
      })
    } catch (error) {
      throw error
    }
  }
  async getAlarmCollectionsRecords(req, res) {
    try {
      const data = await GaoxinService.getAlarmCollectionsRecords(req.query)
      res.json({
        code: 200,
        data,
        msg: '获取成功',
      })
    } catch (error) {
      throw error
    }
  }
  async getFeature(req, res) {
    try {
      const data = await GaoxinService.getFeature(req.query)
      res.json({
        code: 200,
        data,
        msg: '获取成功',
      })
    } catch (error) {
      throw error
    }
  }
  async getRelatedSettings(req, res) {
    try {
      const data = await GaoxinService.getRelatedSettings()
      res.json({
        code: 200,
        data,
        msg: '获取成功',
      })
    } catch (error) {
      throw error
    }
  }
  async anyTrue(req, res) {
    try {
      res.json({
        code: 200,
        data: true,
        msg: '保存成功',
      })
    } catch (error) {
      throw error
    }
  }
}

module.exports = new GaoxinController()
